<script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 0 
	});
});
</script>
<script language="javascript">
$(document).ready(function() {
    $("#1,#2").keyup(function(e) {
        
    //lay gia tri tu input
      var j = new Array();
      for(var i = 1; i<=2;i++){
          if(!($("#"+i).val())){
              j[i]="null"; 
          }
          else {
              j[i]= $("#"+i).val();
          }   
          //console.log(j[i]);
      }
      if(e.keyCode == 13){
        //call get method
         $('#searchrsx').hide();
               $('#searchload').fadeIn(1000).fadeOut(100);
               $('#searchrs').load( 
                   "../search/" +  j[1] + "/" + j[2]+"/"+<?php echo $khoa_id;?>
                   , function () {                         
                    $(this).show();
                   }); 
            } 
        });
});
</script>
<div id="tabs">
	<ul>
        <li><a href='#cd'>Danh sách chi đoàn</a> </li>
        <li><?php echo $this->Html->link(__('Thêm chi đoàn', true), array('action' => 'add',$user['Z1user'] ['khoa_id'])); ?></li>
</ul>
<?php //echo $this->element('search-form');?>
<div class="chidoansvs index" id="cd">
	<h2><?php __('Danh sách các chi đoàn khoa '.$tenkhoa[0]['khoas'] ['tenkhoa']);?></h2>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Mã chi đoàn';?></th>
			<th><?php echo 'Tên chi đoàn';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr> 
    <tr>
            <td></td>
             <td><?php echo $this->Form->input(1,array('label'=>'','id'=>1));?></td>
             <td><?php echo $this->Form->input(2,array('label'=>'','id'=>2));?></td>         
	</tr>
    <tbody id="searchrs"><p style="display: none;" id="searchload">Loading...</p></tbody>
    <tbody id="searchrsx">
	<?php
	$i = 0;$stt=0;
	foreach ($chidoansvs as $chidoansv):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>    
	<tr<?php echo $class;?>>
		<td><?php echo $stt=$stt+1; ?>&nbsp;</td>
		<td><?php echo $chidoansv['Chidoansv']['machidoansv']; ?>&nbsp;</td>
		<td><?php echo $chidoansv['Chidoansv']['tenchidoan']; ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Sửa', true), array('action' => 'edit', $chidoansv['Chidoansv']['id'])); ?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $chidoansv['Chidoansv']['id'],$khoa_id), null, sprintf(__('Bạn muốn xóa chi đoàn này ?', true), $chidoansv['Chidoansv']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</tbody>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
    
</div>
</div>